package org.jfteam.common.domain;

import java.util.Date;

/**
 * created with IntelliJ IDEA.
 * description: 描述
 * author:      fengwenping
 * date:        2019/7/14 21:12
 */
public class BaseEntity {

    private String id;
    private String createdBy;
    private Date createdDate;
    private String updatedBy;
    private Date updatedDate;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public String getUpdatedBy() {
        return updatedBy;
    }

    public void setUpdatedBy(String updatedBy) {
        this.updatedBy = updatedBy;
    }

    public Date getUpdatedDate() {
        return updatedDate;
    }

    public void setUpdatedDate(Date updatedDate) {
        this.updatedDate = updatedDate;
    }

    public void initCreatedAndUpdated(String userId) {
        this.createdBy = userId;
        this.updatedBy = userId;
        final Date date = new Date();
        this.createdDate = date;
        this.updatedDate = date;
    }

    public void initUpdated(String userId) {
        this.updatedBy = userId;
        this.updatedDate = new Date();
    }
}
